package com.devinlee.designpatterns.factory.simple_factory;

import com.devinlee.designpatterns.factory.simple_factory.car.Car;

/**
 * 简单工厂模式-工厂类
 */
public class SimpleFactory {

    /**
     * 具体生产方法
     * @param brand
     * @return
     * @throws ClassNotFoundException
     * @throws IllegalAccessException
     * @throws InstantiationException
     */
    public static Car create(String brand) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        return (Car) Class.forName(brand).newInstance();
    }
}
